﻿using System;

namespace IFramework
{
    public class ThreadTaskBox : IThreadTaskBox, IPoolObj
    {
        private Action action;
        private Action callBack;
        public Action Action
        {
            get
            {
                return action;
            }
        }

        public Action CallBack
        {
            get
            {
                return callBack;
            }
        }

        private void OnUse(params object[] paras)
        {
            this.callBack = paras[1] as Action;
            this.action = paras[0] as Action;
        }
        public void OnCreate(params object[] paras)
        {
            OnUse(paras);
        }

        public void OnReuse(params object[] paras)
        {
            OnUse(paras);
        }

        public void OnRestore(params object[] paras)
        {
            action = null;
            callBack = null;
        }

        public void OnClean(params object[] paras)
        {
            action = null;
            callBack = null;
        }
    }
}